package cn.lingyangwl.agile.misc.statistic.model.entity;

import cn.lingyangwl.agile.misc.statistic.annotation.*;
import cn.lingyangwl.agile.model.enums.*;
import cn.lingyangwl.agile.tenant.core.*;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Getter;
import lombok.Setter;

/**
 * 按天统计记录
 *
 * @author shenguangyang
 */
@Getter
@Setter
@DataIsolation(tableName = "stat_day_record", filterTenant = true)
@TableName(value = "stat_day_record")
@StatisticEntityConfig(
    value = @GroupField(name = "terminal", value = TerminalEnum.class)
)
public class StatDayRecord extends StatBasePO {
    public static LambdaQueryWrapper<StatDayRecord> lqw() {
        return Wrappers.lambdaQuery();
    }

    /**
     * 终端类型
     * @see cn.lingyangwl.agile.model.enums.TerminalEnum
     */
    protected String terminal;

    // 登录成功次数
    @StatisticField
    private Integer loginSuccessCount;

    // 登录失败次数
    @StatisticField
    private Integer loginFailCount;

    // 退出次数
    @StatisticField
    private Integer logoutCount;

    // 请求成功次数
    @StatisticField
    private Integer accessSuccessCount;

    // 请求失败次数
    @StatisticField
    private Integer accessFailCount;

    // 会员注册数量
    @StatisticField
    private Integer memberRegisterCount;

    // 会员注销数量
    @StatisticField
    private Integer memberCancelCount;
}
